package com.jgp.security.secmodel;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.jgp.common.persistence.UUIDModel;
import com.jgp.common.type.RoleType;
import org.hibernate.annotations.Type;

import javax.persistence.*;

/**
 * 项目   parent
 * 作者   loufei
 * 时间   2018/4/6
 */
@Entity
@Table(name = "sec_user")
public class SecUser extends UUIDModel implements BaseUser {
    
    private static final long serialVersionUID = -3853065739159410355L;
    @Column(name = "username", length = 120)
    private String username;
    
    @Column(name = "nick_name", length = 120)
    private String nickName;
    
    @JsonIgnore
    @Column(name = "password", length = 120)
    private String password;
    
    @JsonIgnore
    @Column(name = "sugar", length = 10)
    private String sugar;
    
    @JsonIgnore
    @Column(name = "encrypt_time")
    private Integer encryptTime;
    
    @Type(type = "yes_no")
    @Column(name = "locked")
    private Boolean locked = false;
    
    @Column(name = "real_name", length = 100)
    private String realName;
    
    @Column(name = "tel", length = 20)
    private String tel;
    
    @Column(name = "email", length = 100)
    private String email;
    
    @Column(name="third_open_id")
    private String thirdOpenId;
    
    @Column(name="default_institution_id")
    private Long defaultInstitutionId;
    
    @Column(name="sort")
    private Long sort;
    
    /**
     * 用户类型
     */
    @Column(name = "type", length = 10)
    @Enumerated(EnumType.STRING)
    private RoleType type;
    
    public SecUser() {
    }
    
    public SecUser(String id) {
        this.setId(id);
    }
    
    @Override
    public String getUsername() {
        return username;
    }
    
    public void setUsername(String username) {
        this.username = username;
    }
    
    @Override
    public String getPassword() {
        return password;
    }
    
    public void setPassword(String password) {
        this.password = password;
    }
    
    @Override
    public String getSugar() {
        return sugar;
    }
    
    public void setSugar(String sugar) {
        this.sugar = sugar;
    }
    
    @Override
    public Integer getEncryptTime() {
        return encryptTime;
    }
    
    public void setEncryptTime(Integer encryptTime) {
        this.encryptTime = encryptTime;
    }
    
    @Override
    public Boolean getLocked() {
        return locked;
    }
    
    public void setLocked(Boolean locked) {
        this.locked = locked;
    }
    
    public String getRealName() {
        return realName;
    }
    
    public void setRealName(String realName) {
        this.realName = realName;
    }
    
    public String getTel() {
        return tel;
    }
    
    public void setTel(String tel) {
        this.tel = tel;
    }
    
    public String getEmail() {
        return email;
    }
    
    public void setEmail(String email) {
        this.email = email;
    }
    
    public RoleType getType() {
        return type;
    }
    
    public void setType(RoleType type) {
        this.type = type;
    }
    
    public Long getDefaultInstitutionId() {
        return defaultInstitutionId;
    }
    
    public void setDefaultInstitutionId(Long defaultInstitutionId) {
        this.defaultInstitutionId = defaultInstitutionId;
    }
    
    public String getThirdOpenId() {
        return thirdOpenId;
    }
    
    public void setThirdOpenId(String thirdOpenId) {
        this.thirdOpenId = thirdOpenId;
    }
    
    public String getNickName() {
        return nickName;
    }
    
    public void setNickName(String nickName) {
        this.nickName = nickName;
    }
    
    public Long getSort() {
        return sort;
    }
    
    public void setSort(Long sort) {
        this.sort = sort;
    }
}
